import { request } from '@/utils/request'
//杂活分配值
export const oddJobAllocation = [{
    label: "共享",
    value: 1
}, {
    label: "独享",
    value: 2
}];
//杂活计薪单位
export const oddJobUnit = [{
    label: "计数",
    value: 1
}, {
    label: "小时",
    value: 2
}, {
    label: "分钟",
    value: 3
}];
export const oddJobStatus = [{
    label: "执行中",
    value: 2
}, {
    label: "已完成",
    value: 3
}, {
    label: "废弃",
    value: 5
}];
//获取枚举标签
export function getEnumLabel(obj, value) {
    let item = obj.find(item => item.value == value)
    if(item) {
        return item.label;
    } else {
        return "无";
    }
}

// 加载临活杂工配置数据
export function loadOddJobItemData(data, callback) {
    return request({
        url: "/odd_job/list_item",
        method: "get",
        data,
        isYarn: true
    }, callback);
}

// 增加任务
export function changeJobTask(data, callback) {
    return request({
        url: '/odd_job/change_task',
        method: 'post',
        data,
        type: 'json',
        isYarn: true,
    }, callback);
}

// 加载临活杂工配置数据
export function loadOddJobTaskData(data, callback) {
    return request({
        url: "/odd_job/list_task",
        method: "get",
        data,
        isYarn: true
    }, callback);
}

// 增加任务详情 报工
export function changeTaskDetail(data, callback) {
    return request({
        url: '/odd_job/change_detail',
        method: 'post',
        data,
        type: 'json',
        isYarn: true,
    }, callback);
}

// 加载任务详情
export function loadOddJobTaskDetailData(data, callback) {
    return request({
        url: "/odd_job/list_task_detail",
        method: "get",
        data,
        isYarn: true
    }, callback);
}

// 加载任务详情
export function checkInWorking(data, callback) {
    return request({
        url: "/odd_job/check_in_working",
        method: "get",
        data,
        isYarn: true,
        isReturn: true
    }, callback);
}